package pl.edu.agh.lab2.sr.player;

import java.io.Serializable;
import java.rmi.RemoteException;

public class Player implements IPlayer, Serializable {
	private static final long serialVersionUID = -5821413925565429027L;
	private String nick;

	public Player(String nick) throws RemoteException {
		this.nick = nick;
	}

	@Override
	public String getNick() {
		return nick;
	}

	@Override
	public String toString() {
		return "Player [nick = " + nick + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((nick == null) ? 0 : nick.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Player other = (Player) obj;
		if (nick == null) {
			if (other.nick != null)
				return false;
		} else if (!nick.equals(other.nick))
			return false;
		return true;
	}

	@Override
	public void infoFromGame(String info) {
		System.out.println("[G] " + info);
	}

	private String about;

	@Override
	public void setAbout(String about) {
		this.about = about;
	}

	@Override
	public String getAbout() {
		return about;
	}

}
